
CREATE TABLE [dbo].[User_Role_Mapping](
	[User_Id] [int] NOT NULL,
	[Role_Id] [int] NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[User_Id] ASC,
	[Role_Id] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

ALTER TABLE [dbo].[User_Role_Mapping]  WITH CHECK ADD  
CONSTRAINT [user_userroles_Source] FOREIGN KEY([User_Id])
REFERENCES [dbo].[User] ([Id])
ON DELETE CASCADE
GO

ALTER TABLE [dbo].[User_Role_Mapping]
CHECK CONSTRAINT [user_userroles_Source]
GO

ALTER TABLE [dbo].[User_Role_Mapping]  
WITH CHECK ADD  CONSTRAINT [user_userroles_Target] FOREIGN KEY([Role_Id])
REFERENCES [dbo].[Role] ([Id])
ON DELETE CASCADE
GO

ALTER TABLE [dbo].[User_Role_Mapping] CHECK CONSTRAINT [user_userroles_Target]
GO
